package com.learn.mvc.handler;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class Demo01Handler {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    // @RequestMapping注解在请求地址和Java方法之间建立映射关系
    @RequestMapping("/")
    public String showPortal() {
        return "portal";
    }

    @RequestMapping("/say/hello/to/springmvc")
    public String sayHello() {
        logger.debug("我是 springMVC的 Hello World");
        return "target";
    }


    @RequestMapping("/fruit/*")
    public String testUrlMatching() {
        logger.debug("test @RequestMapping 注解模糊匹配");
        return "target";
    }
}
